package com.jsoft.configuration;

import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**线程工厂
 * @author : handsome Boy
 * @description :
 * @createDate : 2025/3/19 15:31
 */
@Configuration
public class ThreadPoolConfiguration {
@Bean
public ThreadPoolExecutor threadPoolExecutor(){
    return new ThreadPoolExecutor(10,
            20,
            120,
            TimeUnit.SECONDS,
            new ArrayBlockingQueue<>(100),
            new BasicThreadFactory.Builder().namingPattern("log-%d").daemon(true).build(),
            new ThreadPoolExecutor.AbortPolicy());


}

}
